package com.kucai.yifaqapp.presenter.activity;

import com.kucai.yifaqapp.global.HttpAdress;
import com.kucai.yifaqapp.model.CustomObserver;
import com.kucai.yifaqapp.model.network.HttpJsonUtils;
import com.kucai.yifaqapp.model.network.entity.res.ResCording;
import com.kucai.yifaqapp.ui.activity.RecrdActivity;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;

/**
 * Created by Administrator on 2018/11/30.
 */

public class RecrdActivityPresenter extends BaseActivityPresenter<RecrdActivity> {
    public RecrdActivityPresenter(RecrdActivity mActivity) {
        super(mActivity);
    }

    /**
     * 下注记录
     */
    public void getrecording(String token, String startdata, String enddata) {
        HttpJsonUtils.getHttpApiInstance()
                .getrecording(HttpAdress.getuseAdress() + "api/m/user/getStatBets",token, startdata, enddata)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new CustomObserver<ResCording>(mActivity) {
                    @Override
                    protected void onSubscribeCustom(Disposable disposable) {
                    }

                    @Override
                    protected void onErrorCustom(Throwable e) {

                    }

                    @Override
                    protected void onCustomNext(ResCording resCording) {
                        if (null != resCording.data) {
                            mActivity.getCording(resCording);
                        }
                    }
                });
    }
}
